#include<stdio.h>
int main(int argc, char* argv[]){
    if(argc != 3){
        printf("Usage: %s <input_file> <output_file>\n", argv[0]);
        return 1;
    }

    const char* srcfile = argv[1];
    const char* destfile = argv[2];
    FILE* src_file_p = fopen(srcfile,"r");
    if(src_file_p == NULL){
        perror("Error opening source file");
        return -1;
    }

    FILE* dest_file_p = fopen(destfile,"w");
    if(dest_file_p == NULL){
        fclose(src_file_p);
        perror("Error opening destination file");
        return -1;
    }

    char ch =' ';
    while((ch = fgetc(src_file_p)) != EOF){
        fputc(ch, dest_file_p);
    }

    fclose(dest_file_p);
    fclose(src_file_p);
    printf("File copied successfully\n");
    return 0;
}